#!/bin/bash

logo=$(cat <<'EOF'
     ______ _                 _         _   _             _    
    |  ____| |               | |       | | | |           | |   
    | |__  | | ___   ___   __| |   __ _| |_| |_ __ _  ___| | __
    |  __| | |/ _ \ / _ \ / _` |  / _` | __| __/ _` |/ __| |/ /
    | |    | | (_) | (_) | (_| | | (_| | |_| || (_| | (__|   < 
    |_|    |_|\___/ \___/ \__,_|  \__,_|\__|\__\__,_|\___|_|\_\
EOF
)
echo -e "$logo"

echo -e "\033[1;32;40m[*] Flood_attack 是一种通过发送大量恶意请求或数据包来压倒目标系统的网络攻击类型，导致其资源耗尽，无法正常运行。\033[1;37;40m"

declare -A files
files=(
    ["1"]="ddos_cn/Flood_attack/ACK_Flood.py"
    ["2"]="ddos_cn/Flood_attack/DNS_Query_Flood.py"
    ["3"]="ddos_cn/Flood_attack/ICMP_Flood.py"
    ["4"]="ddos_cn/Flood_attack/Ntp_Request_Flood.py"
    ["5"]="ddos_cn/Flood_attack/UDP_Reflection_Flood.py"
    ["6"]="ddos_cn/Flood_attack/Connection_Flood.py"
    ["7"]="ddos_cn/Flood_attack/HTTP_Flood.py"
    ["8"]="ddos_cn/Flood_attack/IP_lood.py"
    ["9"]="ddos_cn/Flood_attack/SYN_Flood.py"
    ["10"]="ddos_cn/Flood_attack/HTTP_Flood_AMT.py"
    ["11"]="ddos_cn/Flood_attack/UDP_Flood_AMT.py"
    ["12"]="ddos_cn/Flood_attack/Advanced_IP_Flooding.py"
    ["13"]="ddos_cn/Flood_attack/Advanced_HTTP_Flooding.py"
    ["14"]="ddos_cn/Flood_attack/Advanced_ICMP_Flooding.py"
    ["15"]="ddos_cn/Flood_attack/Advanced_DNS_Query_Flood.py"
    ["16"]="ddos_cn/Flood_attack/Advanced_UDP_Reflection_Flood.py"
    ["17"]="ddos_cn/Flood_attack/Advanced_SYN_Flood.py"
)

while true; do
    choice=$(whiptail --title "DDoS攻击类型" --menu "Flood_attack是一种通过发送大量恶意请求或数据包来压倒目标系统的网络攻击类型，导致其资源耗尽，无法正常运行。\n\n请选择攻击模式：" 35 78 20 \
    "1" "ACK Flood（ACK洪水攻击）" \
    "2" "DNS Query Flood（DNS查询洪水攻击）" \
    "3" "ICMP Flood（ICMP洪水攻击）" \
    "4" "NTP Request Flood（NTP请求洪水攻击）" \
    "5" "UDP Reflection Flood（UDP反射洪水攻击）" \
    "6" "Connection Flood（连接洪水攻击）" \
    "7" "HTTP Flood（HTTP洪水攻击）" \
    "8" "IP Flood（IP洪水攻击）" \
    "9" "SYN Flood（SYN洪水攻击）" \
    "10" "HTTP Flood Attack on Multiple Targets(HTTP洪水攻击多目标版)" \
    "11" "UDP Flood Attack on Multiple Targets(UDP洪水攻击多目标版)" \
    "12" "Advanced IP Flooding（高级IP洪水攻击）" \
    "13" "Advanced HTTP Flooding（高级HTTP洪水攻击）" \
    "14" "Advanced ICMP Flooding（高级ICMP洪水攻击）" \
    "15" "Advanced DNS Query Flood（高级DNS查询洪水攻击）" \
    "16" "Advanced UDP Reflection Flood（高级UDP反射洪水攻击）" \
    "17" "Advanced SYN Flood（高级SYN洪水攻击）" \
    "0" "返回" \
    3>&1 1>&2 2>&3)

    if [[ $? -eq 0 ]]; then
        if [[ "$choice" == "" ]]; then
            echo "操作已取消。"
            break
        fi

        python3 "${files[$choice]}"
        break
    else
        echo "操作已取消。"
        break
    fi
done